<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}



</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li><a href="javascript:history.back();">营销工具</a></li>
                <li><a href="javascript:history.back(-1)">活动营销</a></li>
                <li class="active" style="color: #02b87f;">付费券列表</li>
            </ul>
        </div>

        <div class="panel panel-default mgl15 mgr15">
            <div class="panel-heading addCharts" style="background:#ededed;">付费券列表
                <a class="btn btn-info copytext"  data-clipboard-action="copy"
                   data-clipboard-text="{$card['shop_url']}"
                 >复制商城链接</a>
                <a class="btn btn-info pull-right" href="{:url('marke/paypurcardsadd')}"
                   style="margin-top: -7px;">添加付费券</a>

            </div>
            <div class="panel-body">

                <table class="table table-bordered" data-toolbar="#toolbar">
                    <thead>
                    <tr>
                        <th>ID</th>

                        <th>名称</th>
                        <th>价格</th>
                        <th>当前状态</th>
                        <th>是否支持余额支付</th>
                        <th>是否支持微信支付</th>
                        <th>开始时间</th>
                        <th>结束时间</th>
                        <th>已购数量</th>
                        <th>添加时间</th>
                        <th>投放链接</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <tr>
                        {volist name="list" id="vo"}
                        <td>{$vo['id']}</td>

                        <td>{$vo['title']}</td>
                        <td>{$vo['price']}</td>
                        <td>
                            {if
                            condition="$vo['status']=='0' "}
                            <a class="btn-link" href="javascript:;" data-id="{$vo['id']}" onclick="status(this);" style="color:#FF3030">下架</a>
                            {else/}
                            <a class="btn-link" href="javascript:;" data-id="{$vo['id']}" onclick="status(this);">上架</a>
                            {/if}
                        </td>
                        <td> {if condition="$vo['is_cardpay']=='2' "}支持{else/}不支持{/if}</td>
                        <td> {if condition="$vo['is_wxpay']=='2' "}支持{else/}不支持{/if}</td>
                        <td>{$vo['starttime']|date="Y-m-d",###}</td>
                        <td>{$vo['endtime']|date="Y-m-d",###}</td>
                        <td><a href="{:url('marke/paypurcardslog',['fid'=>$vo['id']])}" class="btn-link">{$vo['get_num']}</a>
                        </td>

                        <td>{$vo['addtime']|date="Y-m-d H:i:s",###}</td>
                        <td><a href="javascript:;" data-clipboard-action="copy"
                               data-clipboard-text="{$card['url']}fid/{$vo['id']}/mid/{$vo['mid']}"
                               class="copytext">点击复制</a></td>
                        <td>
                            <a href="{:url('marke/paypurcardsinfo',['id'=>$vo['id']])}" class="btn-link">查看</a>
                            <a href="{:url('marke/paypurcardsedit',['id'=>$vo['id']])}" class="btn-link"> | 修改</a>
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>

            </div>

        </div>
        {include file='public/footer'/}
    </div>

</section>
</body>
<script src="__STATIC_URL__/static/js/clipboard.min.js"></script>
<script>
    // $(function () {

        var clipboard =  new Clipboard('.copytext');

        clipboard.on('success', function (e) {
            layer.msg('复制成功');
        });

        clipboard.on('error', function (e) {
            layer.msg('复制失败');
        });
    // })
</script>
<script type="text/javascript">
    function status(obj) {
        var id = $(obj).attr("data-id");
        console.log(id);
        $.ajax({
            url: "{:url('marke/paypurcardsstatu')}",
            type: "post",
            data: {
                id: id
            },
            success: function (data) {
                console.log(11, data);
                window.location.reload();

            }
        })

    }


</script>


</html>
